/**
 * Copyright 2008-2009 HAN.BIFANG
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */
package han.bifang.gwt.client.service.content;

import han.bifang.gwt.client.common.Content;
import han.bifang.gwt.client.common.ContentChangeListener;
import han.bifang.gwt.client.common.GwtContext;
import han.bifang.gwt.client.communicate.BifangGWTServiceAsync;
import han.bifang.gwt.client.service.ServiceMessages;

import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.VerticalPanel;

/**
 * 
 * @Author Kent
 */
public class SearchContent extends Content {
	
	private VerticalPanel panel = null;
	private ResultPanel rp;
	private ConditionPanel cp;
	
	public void refreshService(){
		if(rp != null){
			rp.refreshService();
		}
	}
	
	public void refreshMappingService(){
		if(rp != null){
			rp.refreshMappingService();
		}
	}

	public SearchContent(ServiceMessages scons, BifangGWTServiceAsync s,
			GwtContext context, String appId, String domainId) {
		panel = new VerticalPanel();
		panel.setWidth("100%");
		panel.setSpacing(5);
		rp = new ResultPanel(scons,s,context,null,null);
		
		cp = new ConditionPanel(scons,context,rp,appId,domainId);
		
		panel.add(cp);
		panel.add(new HTML("&nbsp;"));
		panel.add(rp);
		
		initWidget(panel);
		
		
	}
	
	public void setContentChangeListener(ContentChangeListener l){
		rp.setContentChangeListener(l);
		cp.setContentChangeListener(l);
	}
	
	

}
